package com.apes.framework.plugin.workflow.parser.element;

import com.apes.framework.plugin.esb.processor.mapping.parser.element.ConfigElementParser;
import com.apes.framework.plugin.esb.processor.mapping.parser.model.Config;
import com.apes.framework.plugin.filereader.xml.ApesElement;
import com.apes.framework.plugin.filereader.xml.ApesElementParser;
import com.apes.framework.plugin.workflow.parser.node.WorkflowNodeParser;
import org.springframework.stereotype.Component;

/**
 * 功能：mapping元素解析器
 *
 * @author xul
 * @create 2018-06-30 11:30
 */
@Component("workflow.mappingElementParser")
public class MappingElementParser implements ApesElementParser<ApesElement, Config> {
    /**
     * 可解析的元素列表
     **/
    private final String[] elementNames = {"mapping", "content"};

    /**
     * 功能：可解析的节点或元素列表
     */
    @Override
    public String[] getNames() {
        return elementNames;
    }

    /**
     * 功能：可解析节点域
     */
    @Override
    public String getDomain() {
        return WorkflowNodeParser.domain;
    }

    /**
     * 功能：元素解析
     *
     * @param element
     */
    @Override
    public Config parse(ApesElement element) {
        return new ConfigElementParser().parse(element);
    }
}
